<template>
  <div
    style="width: 100%"
    class="ShopClassList"
  >
    <div
      v-for="shops in goodsData"
      :key="shops.index"
      class="good-list-box"
    >
      <div class="goods-list-itme shop-box">
        <div class="logo">
          <img
            :src="shops.detail.cLogoUrl"
            :alt="shops.detail.cShopName"
            class="logo-img"
          >
        </div>
        <div class="shop-name">
          {{ shops.detail.cShopName }}
        </div>
        <div class="shop-type">
          {{ shops.detail.cShopTag }}
        </div>
        <div class="shop-status">
          {{ shops.detail.bCorpStore }}人已关注
        </div>
        <div class="goods-footer">
          <div class="goods-footer-item">
            <i class="el-icon-goods" />
            <span>数量：100件</span>
          </div>
          <div class="goods-footer-item">
            <i class="el-icon-document-checked" />
            <span>成交：20笔</span>
          </div>
          <div class="goods-footer-item">
            <i class="iconfont el-icon-haoping" />
            <span>好评：100%</span>
          </div>
        </div>
      </div>
     
      <div
        v-for="(item,index) in shops.GoodsListData" 
        :key="index"
        class="goods-list-itme"
      >
        <!-- {{ item }} -->
        <div
          v-if="index < 4"
          class="goods-box"
        >
          <img
            :src="item.defaultAlbum"
            :alt="item.cProductShowName"
            class="goods-img"
          >
          
          <p class="name">
            {{ item.cProductShowName }}
          </p>
          <p class="price">
            ￥ {{ item.fSalePrice }}
          </p>
        </div>
      </div>
    </div>
    <div
      v-if="lastPage > page"
      class="more"
      @click="getMore"
    >
      点击加载更多+
    </div>
    <div
      v-else
      class="more"
    >
      没有更多
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  components: {},
  props: {
    lastPage: {
      type: Number, //指定传入的类型
      //type 也可以是一个自定义构造器函数，使用 instanceof 检测。
      default: 0,
    },
    newGoodsData: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      page: 1,
    };
  },
  created() {
    console.log('子组件接受',this,this.goodsData)
  },
  methods: {
    
    //跳转商品详情
    goDetail(item) {
      this.$router.push({
        path: "/fruit/detail",
        query: {
          id: item.pid,
          iShopId: item.iShopId
        },
      });
    },
    getMore() {
      this.page++;
      this.$emit("getMore", this.page);
    },
  },
};
</script>

<style scoped lang="scss">
.good-list-box {
  margin-bottom: 1.88rem;
  width: 100%;
  display: flex;
  justify-content: space-between;
  background: white;
  align-items: center;

  .goods-list-itme {
    width: 16.5rem;
    height: 25rem;
    display: flex;
    background: white;
    align-items: center;
    justify-content: center;
    .goods-box {
      background: white;
    }
    .goods-img {
      width: 15rem;
      height: 15rem;
      margin: 0 auto;
      text-align: center;
    }
    .name {
      font-size: 1.13rem;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #040000;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      width: 15rem;
      margin-top: 0.94rem;
      text-align: center;
    }
    .price {
      font-size: 1.5rem;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #f3406f;
      margin-top: 0.94rem;
      width: 15rem;
      text-align: center;
    }
  }
  .shop-box {
    background: #00dea9;
    flex-direction: column;
    color: white;
    font-weight: 400;
    .logo-img {
      background: white;
      width: 7rem;
      height: 7rem;
      border-radius: 100%;
      text-align: center;
      line-height: 7rem;
    }
    .shop-name {
      font-size: 1.5rem;
      padding: 1rem 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      width: 16.5rem;
      text-align: center;
    }
    .shop-type {
      font-size: 0.8rem;
      line-height: 1.5rem;
      border-top: white 0.1rem solid;
      border-bottom: white 0.1rem solid;
      width: 4rem;
      text-align: center;
    }
    .shop-status {
      font-size: 1rem;
      line-height: 2.8rem;
    }
    .goods-footer {
      width: 100%;
      display: flex;
      justify-content: space-between;
      .goods-footer-item {
        margin: 0.5rem;
        padding-top: 2rem;
        width: 6rem;
        height: 3rem;
        text-align: center;
        display: flex;
        flex-direction: column;
        i {
          line-height: 3rem;
          font-size: 1.6rem;
        }
        span {
          font-size: 0.6rem;
        }
      }
    }
  }
}
.more {
  font-size: 1rem;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: rgba(102, 102, 102, 1);
  line-height: 1.95rem;
  text-align: center;
  margin: 3.13rem auto;
  cursor: pointer;
}
</style>
